<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
<title>模板管理器</title>
<link href="img/base.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.linerow { border-bottom: 1px solid #CBD8AC; }
td { padding-left:5px; }
</style>
<script  language="javascript">
function DelTpl(filename)
{
	if(window.confirm('你确定要删除这篇文档吗?')) location='tpl.php?action=del&acdir=<?php echo $acdir; ?>&filename='+filename;
	else return false;
}
</script>
</head>
<body background='img/allbg.gif' leftmargin='8' topmargin='8'>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#D1DDAA" style="margin-bottom:6px;">
  <tr>
   <td height="28" background="img/tbg.gif" colspan="7">
     <b>模板管理</b>
	</td>
</tr>
</table>
<table width='98%' border='0' cellspacing='0' cellpadding='0' style="border:1px solid #CBD8AC;" align="center">
   <tr height="26" align="center">
     <td width="25%" class='linerow' background="img/wbg.gif"><strong>文件名</strong></td>
     <td width="33%" class='linerow' background="img/wbg.gif"><strong>文件描述</strong></td>
     <td width="22%" class='linerow' background="img/wbg.gif"><strong>修改时间</strong></td>
     <td width="20%" class='linerow' background="img/wbg.gif"><strong>操作</strong></td>
   </tr>
   <tr>
      <td class='linerow' colspan='4' height="28" bgcolor='#FAFEEF'>
      	<div style='float:left'>
      	<b>
      		当前位置：
      		<?php
      		if($acdir=='plus') echo '插件模板';
      		else if($acdir=='system') echo '底层模板';
      		else echo '核心模板 &gt; '.$acdir;
      		?>
      	</b>
        </div>
      	<div style='float:right;padding-right:10px'>
      		<a href='templets_main.php'>[<u>默认模板目录</u>]</a>
      		<a href='templets_main.php?acdir=plus'>[<u>插件模板目录</u>]</a>
        </div>
      </td>
   </tr>
   <?php
   $dh = dir($templetdird);
   while($filename=$dh->read())
   {
   	  if(!ereg("\.htm",$filename)) continue;
   	  $filetime = filemtime($templetdird.'/'.$filename);
      $filetime = MyDate("Y-m-d H:i",$filetime);
      $fileinfo = (isset($fileinfos[$filename]) ? $fileinfos[$filename] : '未知模板');
   ?>
   <tr height="26" bgcolor='#FFFFFF' onMouseMove="javascript:this.bgColor='#F9FBF0';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
	  <td class='linerow'>
        <a href='<?php echo $templeturld.'/'.$filename; ?>' target='_blank'>
        	<img src='img/htm.gif' border='0' align='absmiddle' /><?php echo $filename; ?>
        </a>
    </td>
		<td class='linerow'>
			<?php echo $fileinfo; ?>
		</td>
		<td align='center' class='linerow'>
			<?php echo $filetime; ?>
		</td>
		<td class='linerow' align='center'>
			<a href='tpl.php?action=edit&acdir=<?php echo $acdir; ?>&filename=<?php echo $filename; ?>'>[修改]</a>
			<?php
			if(!isset($fileinfos[$filename]))
			{
			?>
			 | 
			<a href='#' onclick="javascript:DelTpl('<?php echo $filename; ?>');">[删除]</a>
			<?php
		   }
			?>
		</td>
	</tr>
	<?php } ?>
	<tr>
    <td colspan="4" height='32' bgcolor='#F8FEE0'>
      &nbsp;
      <a href='tpl.php?action=newfile&acdir=<?php echo $acdir; ?>'>[新建模板]</a>
      &nbsp;
      <a href='tpl.php?action=upload&acdir=<?php echo $acdir; ?>'>[上传模板]</a>
    </td>
  </tr>
</table>

</body>
</html>
